import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home',
  },
  {
    path: '/home',
    name: 'Home',
    component: Home
  },
  {
    path: '/cate',
    name: 'cate',
    //路由懒加载
    component: () => import('@views/Cate')
  },
  {
    path: '/cart',
    name: 'cart',
    component: () => import('@views/Cart')
  },
  {
    path: '/user',
    name: 'user',
    component: () => import('@views/User')
  },
  {
    path: '/itemLists',
    name: 'itemLists',
    component: () => import('@views/ItemLists')
  },
  {
    path: '/detail/:itemId',
    name: 'detail',
    component: () => import('@views/Detail')
  }
]

const router = new VueRouter({
  routes
})

export default router
